#ifndef __SUGGEST_API_H__
#define __SUGGEST_API_H__
#pragma once

struct STErrorInfo;

struct STSuggestRequest
{
	std::string hit;
	std::string index_name;
	std::string suggest_name;
	std::string query;
};

struct STSuggestResponse
{
	std::string request_id;
	float searchtime;
	std::vector<std::string> suggestions;
	std::vector<STErrorInfo> errorList;
};

class DLL_OPENSEARCH_API CSuggestTips
{
public:
	static CSuggestTips* getInstance();

	bool Initialize(std::string host);
	bool Destory();

	STSuggestResponse* suggest(STSuggestRequest *pRequest);
	bool parseSuggestResponse();

	STSuggestResponse m_suggestResponse;
	std::string m_strUrl;
	std::map<std::string, std::string> m_mapRequestParameter;
	std::vector<std::string> m_vecRequestParameter;
private:
	CSuggestTips();
	~CSuggestTips();
};

#endif